<?php
/**
 * Masapay Magento Plugin.
 * v1.1.8 - November 8th, 2013
 * 
 * 
 * Copyright (c) 2013 Masapay
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions 
 * are met:
 * 
 *     - Redistributions of source code must retain the above copyright 
 *       notice, this list of conditions and the following disclaimer.
 *     - Redistributions in binary form must reproduce the above 
 *       copyright notice, this list of conditions and the following 
 *       disclaimer in the documentation and/or other materials 
 *       provided with the distribution.
 *     - Neither the name of the Masapay nor the names of its 
 *       contributors may be used to endorse or promote products 
 *       derived from this software without specific prior written 
 *       permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 * POSSIBILITY OF SUCH DAMAGE.
 * 
 * @category    design_default
 * @package     Mage_Masapay
 * @copyright   Copyright (c) 2013 Masapay  (www.Masapay.com)
 * @license     http://opensource.org/licenses/bsd-license.php  BSD License
 */
$masapayInfo = $this->createMasaPayDeviceFingerprintID();
?>
<fieldset class="form-list">
    <?php $_code=$this->getMethodCode() ?>
    <ul id="payment_form_<?php echo $_code ?>" style="display:none">
        <li>
            <div class="input-box">
                <label for="<?php echo $_code ?>_cc_owner"><?php echo $this->__('Name on Card') ?> <span class="required">*</span></label><br/>
                <input type="text" title="<?php echo $this->__('Name on Card') ?>" class="required-entry input-text" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>"/>
                <input name="payment[cc_ss_issue]" type="hidden" value="<?php echo $masapayInfo['sessionId'] ?>"/>
            </div>
        </li>
        <li>
            <div class="input-box">
                <label for="<?php echo $_code ?>_cc_type"><?php echo $this->__('Credit Card Type') ?> <span class="required">*</span></label><br />
                <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry mw-validate-cc-type-select">
                    <option value=""><?php echo $this->__('--Please Select--')?></option>
                <?php $_ccType = $this->getInfoData('cc_type') ?>
                <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
                    <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
                <?php endforeach ?>
                </select>
            </div>
        </li>
        <li>
            <div class="input-box">
                <label for="<?php echo $_code ?>_cc_number"><?php echo "Credit Card Number" ?> <span class="required">*</span></label><br/>
                <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
            </div>
        </li>
        <li>
            <div class="input-box">
                <label for="<?php echo $_code ?>_expiration"><?php echo $this->__('Expiration Date') ?> <span class="required">*</span></label><br />
                <div class="v-fix">
                <select id="<?php echo $_code ?>_expiration" style="width:140px;" name="payment[cc_exp_month]" class="required-entry">
                <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
                <?php foreach ($this->getCcMonths() as $k=>$v): ?>
                    <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
                <?php endforeach ?>
                </select>
                </div>
                <div class="v-fix" style="padding-left:5px;">
                <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
                <select id="<?php echo $_code ?>_expiration_yr" style="width:103px;" name="payment[cc_exp_year]" class="required-entry">
                <?php foreach ($this->getCcYears() as $k=>$v): ?>
                    <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
                <?php endforeach ?>
                </select>
                </div>
            </div>
        </li>
        <li>
            <div class="input-box">
                <label for="<?php echo $_code ?>_cc_cid"><?php echo $this->__('Card Verification Number') ?> <span class="required">*</span></label><br />
                <div class="v-fix"><input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="required-entry input-text validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" style="width:3em;" value="" /></div>
                &nbsp;
                <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
            </div>
        </li>
    </ul>
	<img src="https://h.online-metrix.net/fp/clear.png?org_id=<?php echo $masapayInfo['orgId'] ?>&session_id=<?php echo $masapayInfo['masapayId'].$masapayInfo['sessionId'] ?>&m=2" alt="">
</fieldset>

<?php
// REM: this is outside the hidden area to avoid possible http request issues
if(empty($this->_paymentConfig['extendedfraudprofiling']))
{
	$fraudProfiler = $this->createExtendedFraudProfilingSession($masapayInfo);

	if($fraudProfiler) echo '<div style="position:absolute;left:-5000px;line-height:1px;">'.$fraudProfiler['html'].'</div>';
}
?>
